import { Component, OnInit } from '@angular/core';
import { PAYMENT_METHOD_OPTION } from '../../../constant/dictionary';
import { ActivityProductService } from '@core/routes-services/activity-product.service';
import { NzMessageService } from 'ng-zorro-antd';

@Component({
  selector: 'app-cake-order',
  templateUrl: './cake-order.component.html',
})
export class CakeOrderComponent implements OnInit {

  paymentMethod: any [] = PAYMENT_METHOD_OPTION;
  status: any = 0;
  isLoading = false;


  allProducts:any [] = [];
  constructor(private message: NzMessageService,
              private activityProductService:ActivityProductService) {
  }

  ngOnInit() {
    this.activityProductService.getAll().then((res) => {
      if (res.status.toString().startsWith("20")) {
        this.allProducts = res.data.activityProductsList;
      } else {
        this.message.warning(res.message);
      }
    }, error => {
      this.message.error(error.message ? error.message : error.error)
    });
  }


}
